from MachineLearning.data import readData
from MachineLearning.kNN import KNNClassifier
from MachineLearning.kNN import get_k
from MachineLearning.metrics import accuracy_score
from MachineLearning.model_selection import train_test_split
from MachineLearning.processing import StandardScaler

def get_tag():
    X,y = readData()
    X_train, X_test, y_train,y_test= train_test_split(X,y)
    k = get_k(X_train,y_train,X_test,y_test)
    classifier = KNNClassifier(k)
    classifier.fit(X_train,y_train)
    tag = classifier.predict(X_test)
    score = classifier.score(X_test,y_test)
    print(tag)
    print("准确率为："+str(score))
    return tag